
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>基本功能 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="interface.html" />
    
    
    <link rel="prev" href="general.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    入门
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../introduction/environment.html">
            
                <a href="../introduction/environment.html">
            
                    
                    环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../introduction/hello.html">
            
                <a href="../introduction/hello.html">
            
                    
                    HelloWorld
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../introduction/dev-and-debug.html">
            
                <a href="../introduction/dev-and-debug.html">
            
                    
                    开发与调试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    参考
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../framework/file.html">
            
                <a href="../framework/file.html">
            
                    
                    文件组织
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../framework/manifest.html">
            
                <a href="../framework/manifest.html">
            
                    
                    manifest文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../framework/nml.html">
            
                <a href="../framework/nml.html">
            
                    
                    nml文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../framework/page.html">
            
                <a href="../framework/page.html">
            
                    
                    页面与组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    组件
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../component/general.html">
            
                <a href="../component/general.html">
            
                    
                    通用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../component/container.html">
            
                <a href="../component/container.html">
            
                    
                    容器组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../component/basics.html">
            
                <a href="../component/basics.html">
            
                    
                    基础组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../component/form.html">
            
                <a href="../component/form.html">
            
                    
                    表单组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../component/media.html">
            
                <a href="../component/media.html">
            
                    
                    媒体组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    接口
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="general.html">
            
                <a href="general.html">
            
                    
                    通用规则
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.2" data-path="basic.html">
            
                <a href="basic.html">
            
                    
                    基本功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="interface.html">
            
                <a href="interface.html">
            
                    
                    界面交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="request.html">
            
                <a href="request.html">
            
                    
                    网络访问
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="storage.html">
            
                <a href="storage.html">
            
                    
                    文件数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="system.html">
            
                <a href="system.html">
            
                    
                    系统能力
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="media.html">
            
                <a href="media.html">
            
                    
                    图形图像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="share.html">
            
                <a href="share.html">
            
                    
                    分享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="pay.html">
            
                <a href="pay.html">
            
                    
                    支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="stat.html">
            
                <a href="stat.html">
            
                    
                    统计
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >基本功能</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x57FA;&#x672C;&#x529F;&#x80FD;">&#x57FA;&#x672C;&#x529F;&#x80FD;</h2>
<h3 id="&#x5E94;&#x7528;&#x4E0A;&#x4E0B;&#x6587;">&#x5E94;&#x7528;&#x4E0A;&#x4E0B;&#x6587;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>&#x65E0;&#x9700;&#x58F0;&#x660E;&#x3002;</p>
<h4 id="uniappgetinfo">uni.app.getInfo()</h4>
<p>&#x83B7;&#x53D6;&#x5F53;&#x524D;&#x5E94;&#x7528;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<p>&#x65E0;&#x3002;</p>
<p>&#x8FD4;&#x56DE;&#x503C;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">name</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5E94;&#x7528;&#x540D;&#x79F0;</td>
</tr>
<tr>
<td style="text-align:left">versionName</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5E94;&#x7528;&#x7248;&#x672C;&#x540D;&#x79F0;</td>
</tr>
<tr>
<td style="text-align:left">versionCode</td>
<td style="text-align:left">Number</td>
<td style="text-align:left">&#x5E94;&#x7528;&#x7248;&#x672C;&#x53F7;</td>
</tr>
<tr>
<td style="text-align:left">logLevel</td>
<td style="text-align:left">String</td>
<td style="text-align:left">log&#x7EA7;&#x522B;</td>
</tr>
<tr>
<td style="text-align:left">source</td>
<td style="text-align:left">Object</td>
<td style="text-align:left">&#x5E94;&#x7528;&#x6765;&#x6E90;</td>
</tr>
</tbody>
</table>
<p>source &#x8BF4;&#x660E;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">packageName</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x6765;&#x6E90; app &#x7684;&#x5305;&#x540D;&#xFF0C;&#x4E00;&#x7EA7;&#x6765;&#x6E90;</td>
</tr>
<tr>
<td style="text-align:left">type</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x6765;&#x6E90;&#x7C7B;&#x578B;&#xFF0C;&#x4E8C;&#x7EA7;&#x6765;&#x6E90;&#xFF0C;&#x503C;&#x4E3A; shortcut&#x3001;push&#x3001;url&#x3001;barcode&#x3001;nfc&#x3001;bluetooth&#x3001;other&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">extra</td>
<td style="text-align:left">Object</td>
<td style="text-align:left">&#x6765;&#x6E90;&#x5176;&#x4ED6;&#x4FE1;&#x606F;&#xFF0C;&#x4E0E; type &#x76F8;&#x5173;&#xFF0C;&#x4E0D;&#x540C;&#x7684; type&#xFF0C;extra &#x4E2D;&#x7684;&#x5B57;&#x6BB5;&#x4F1A;&#x4E0D;&#x540C;&#x3002;</td>
</tr>
</tbody>
</table>
<p>extra&#x7684;&#x76F8;&#x5173;&#x8BF4;&#x660E;&#x5982;&#x4E0B;&#xFF1A;</p>
<ul>
<li>type=shortcut<ul>
<li>scene&#xFF1A;&#x4E09;&#x7EA7;&#x6765;&#x6E90;&#xFF0C;&#x8868;&#x793A;&#x5FEB;&#x6377;&#x65B9;&#x5F0F;&#x521B;&#x5EFA;&#x7684;&#x573A;&#x666F;&#xFF0C;&#x503C;&#x4E3A;dialog&#xFF08;&#x5E73;&#x53F0;&#x5185;&#x90E8;&#x7B56;&#x7565;Dialog&#x5F39;&#x7A97;&#x521B;&#x5EFA;&#xFF09;&#x3001;api&#xFF08;API&#x63A5;&#x53E3;&#x8C03;&#x7528;&#x521B;&#x5EFA;&#xFF09;&#x3001;web&#xFF08;H5&#x7AD9;&#x63A5;&#x5165;&#x6D41;&#x91CF;&#x5207;&#x6362;&#xFF0C;&#x6D4F;&#x89C8;&#x65F6;&#x521B;&#x5EFA;&#xFF09;&#x3001;other</li>
<li>original&#xFF1A;&#x539F;&#x59CB;&#x6765;&#x6E90; source&#xFF0C;&#x8868;&#x793A;&#x5FEB;&#x6377;&#x65B9;&#x5F0F;&#x521B;&#x5EFA;&#x65F6;&#x7684;&#x6765;&#x6E90;</li>
</ul>
</li>
</ul>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">JSON</span>.stringify(uni.app.getInfo()));
</code></pre>
<h3 id="&#x65E5;&#x5FD7;&#x6253;&#x5370;">&#x65E5;&#x5FD7;&#x6253;&#x5370;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>&#x65E0;&#x9700;&#x58F0;&#x660E;&#x3002;</p>
<h4 id="consoledebugloginfowarnerrormessage">console.debug/log/info/warn/error(message)</h4>
<p>&#x6253;&#x5370;&#x4E00;&#x6BB5;&#x6587;&#x672C;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">message</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x8981;&#x6253;&#x5370;&#x7684;&#x6587;&#x672C;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x683C;&#x5F0F;&#x5316;&#x6587;&#x672C;&#xFF0C;&#x89C4;&#x5219;&#x4E0E;&#x6D4F;&#x89C8;&#x5668;&#x7684;console&#x76F8;&#x540C;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; <span class="hljs-number">5</span>; i++) {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;Hello, %s. You&apos;ve called me %d times.&quot;</span>, <span class="hljs-string">&quot;Bob &quot;</span>, i + <span class="hljs-number">1</span>);
}
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;I want to print a number: %d&quot;</span>, <span class="hljs-number">123456</span>);
</code></pre>
<h3 id="&#x9875;&#x9762;&#x8DEF;&#x7531;">&#x9875;&#x9762;&#x8DEF;&#x7531;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>&#x65E0;&#x9700;&#x58F0;&#x660E;&#x3002;</p>
<h4 id="unirouterpushobject">uni.router.push(OBJECT)</h4>
<p>&#x8DF3;&#x8F6C;&#x5230;&#x5E94;&#x7528;&#x5185;&#x7684;&#x67D0;&#x4E2A;&#x9875;&#x9762;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">uri</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x8BE6;&#x7EC6;&#x53C2;&#x8003;&#x4E0B;&#x6587;</td>
</tr>
<tr>
<td style="text-align:left">params</td>
<td style="text-align:left">Object</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x8DF3;&#x8F6C;&#x65F6;&#x9700;&#x8981;&#x4F20;&#x9012;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x5728;&#x9875;&#x9762;&#x4E2D;&#x901A;&#x8FC7;this.param1&#x7684;&#x65B9;&#x5F0F;&#x4F7F;&#x7528;&#xFF0C;param1&#x4E3A;json&#x4E2D;&#x7684;&#x53C2;&#x6570;&#x540D;&#xFF0C;param1&#x5BF9;&#x5E94;&#x7684;&#x503C;&#x4F1A;&#x7EDF;&#x4E00;&#x8F6C;&#x6362;&#x4E3A;String&#x7C7B;&#x578B;&#x3002;</td>
</tr>
</tbody>
</table>
<p>&#x8981;&#x8DF3;&#x8F6C;&#x5230;&#x7684;uri&#xFF0C;&#x53EF;&#x4EE5;&#x662F;&#x4E0B;&#x9762;&#x7684;&#x683C;&#x5F0F;&#xFF1A;</p>
<ol>
<li>&#x5305;&#x542B;schema&#x7684;&#x5B8C;&#x6574;uri&#xFF1B;&#x76EE;&#x524D;&#x652F;&#x6301;&#x7684;schema&#x6709;tel&#xFF0C;sms&#x548C;mailto&#xFF0C;&#x4F8B;&#x5982;tel:10086&#xFF0C;mailto:abc@gmail.com</li>
<li>&#x4EE5;&quot;/&quot;&#x5F00;&#x5934;&#x7684;&#x5E94;&#x7528;&#x5185;&#x9875;&#x9762;&#x7684;&#x8DEF;&#x5F84;&#xFF1B;&#x4F8B;&#xFF1A;/about</li>
<li>&#x4EE5;&#x975E;&quot;/&quot;&#x5F00;&#x5934;&#x7684;&#x5E94;&#x7528;&#x5185;&#x9875;&#x9762;&#x7684;&#x540D;&#x79F0;&#xFF1B;&#x4F8B;&#xFF1A;About</li>
<li>&#x7279;&#x6B8A;&#x7684;&#xFF0C;&#x5982;&#x679C;uri&#x7684;&#x503C;&#x662F;&quot;/&quot;,&#x5219;&#x8DF3;&#x8F6C;&#x5230;path&#x4E3A;&quot;/&quot;&#x7684;&#x9875;&#xFF0C;&#x6CA1;&#x6709;&#x5219;&#x8DF3;&#x8F6C;&#x5230;&#x9996;&#x9875;&#x3002;</li>
</ol>
<p>&#x652F;&#x6301;&#x5305;&#x542B;schema&#x7684;&#x5B8C;&#x6574;uri&#x3002;&#x5BF9;&#x4E8E;&#x5E26;&#x6709;schema&#x7684;uri&#xFF0C;&#x5904;&#x7406;&#x6D41;&#x7A0B;&#x5982;&#x4E0B;&#xFF1A;</p>
<ol>
<li>&#x67E5;&#x627E;app&#x4E0B;&#x6240;&#x6709;page&#x7684;filter&#x8BBE;&#x7F6E;&#x6765;&#x9009;&#x62E9;&#x5408;&#x9002;&#x7684;page&#x5904;&#x7406;&#x8BF7;&#x6C42;&#xFF08;&#x53C2;&#x89C1;manifest&#x6587;&#x4EF6;&#xFF09;</li>
<li>&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5408;&#x9002;&#x7684;page&#x80FD;&#x591F;&#x5904;&#x7406;&#x8BF7;&#x6C42;&#xFF0C;&#x4F1A;&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x7B56;&#x7565;&#x6765;&#x5904;&#x7406;&#x8BF7;&#x6C42;&#x3002;&#x76EE;&#x524D;&#x9ED8;&#x8BA4;&#x7B56;&#x7565;&#x652F;&#x6301;&#x5BF9;http&#x3001;https&#x3001;internal&#x8FD9;&#x51E0;&#x79CD;schema&#x7684;&#x5904;&#x7406;</li>
<li>&#x5982;&#x679C;&#x9ED8;&#x8BA4;&#x7B56;&#x7565;&#x4E5F;&#x4E0D;&#x80FD;&#x5904;&#x7406;&#x8BF7;&#x6C42;&#xFF0C;&#x4F1A;&#x5C1D;&#x8BD5;&#x4F7F;&#x7528;&#x7CFB;&#x7EDF;&#x4E2D;&#x7684;&#x5E94;&#x7528;&#x6765;&#x5904;&#x7406;&#x8BF7;&#x6C42;</li>
<li>&#x5982;&#x679C;&#x6CA1;&#x6709;&#x7CFB;&#x7EDF;&#x5E94;&#x7528;&#x53EF;&#x4EE5;&#x5904;&#x7406;&#x8BF7;&#x6C42;&#xFF0C;&#x4F1A;&#x629B;&#x5F03;&#x8BF7;&#x6C42;</li>
</ol>
<p>&#x9ED8;&#x8BA4;&#x7B56;&#x7565;&#x7684;&#x5904;&#x7406;&#x903B;&#x8F91;&#xFF1A;</p>
<ol>
<li>&#x5982;&#x679C;schema&#x662F;http/https&#xFF0C;&#x4F1A;&#x7528;&#x5185;&#x7F6E;&#x7684;web&#x9875;&#x9762;&#x6253;&#x5F00;&#x7F51;&#x9875;</li>
<li>&#x5982;&#x679C;schema&#x662F;internal&#xFF08;&#x53C2;&#x89C1;&#x201C;&#x6587;&#x4EF6;&#x7EC4;&#x7EC7;&#x201D;&#xFF09;&#xFF0C;&#x4F1A;&#x6839;&#x636E;uri&#x7684;&#x6587;&#x4EF6;&#x6269;&#x5C55;&#x540D;&#x6765;&#x786E;&#x5B9A;&#x6587;&#x4EF6;&#x7C7B;&#x578B;&#xFF0C;&#x518D;&#x8C03;&#x7528;&#x7CFB;&#x7EDF;&#x4E2D;&#x7684;&#x5E94;&#x7528;&#x6253;&#x5F00;&#x6587;&#x4EF6;</li>
</ol>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// launch phone app  </span>
uni.router.push({
  uri: <span class="hljs-string">&apos;tel:10086&apos;</span>
});
<span class="hljs-comment">// open page by path  </span>
uni.router.push({
  uri: <span class="hljs-string">&apos;/about&apos;</span>,
  params: {
    testId: <span class="hljs-string">&apos;1&apos;</span>
  }
});
<span class="hljs-comment">// open page by name  </span>
uni.router.push({
  uri: <span class="hljs-string">&apos;About&apos;</span>,
  params: {
    testId: <span class="hljs-string">&apos;1&apos;</span>
  }
});
</code></pre>
<p>&#x65B0;&#x589E;&#x4E0B;&#x9762;&#x7684;&#x7528;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// open web page  </span>
uni.router.push({
  uri: <span class="hljs-string">&apos;http://www.example.com &apos;</span>
});
<span class="hljs-comment">// install apk  </span>
uni.router.push({
  uri: <span class="hljs-string">&apos;internal://cache/example.apk &apos;</span>
});
</code></pre>
<h4 id="unirouterreplaceobject">uni.router.replace(OBJECT)</h4>
<p>&#x8DF3;&#x8F6C;&#x5230;&#x5E94;&#x7528;&#x5185;&#x7684;&#x67D0;&#x4E2A;&#x9875;&#x9762;&#xFF0C;&#x5F53;&#x524D;&#x9875;&#x9762;&#x65E0;&#x6CD5;&#x8FD4;&#x56DE;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">uri</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x8BE6;&#x7EC6;&#x53C2;&#x8003;&#x4E0B;&#x6587;</td>
</tr>
<tr>
<td style="text-align:left">params</td>
<td style="text-align:left">Object</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x8DF3;&#x8F6C;&#x65F6;&#x9700;&#x8981;&#x4F20;&#x9012;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x5728;&#x9875;&#x9762;&#x4E2D;&#x901A;&#x8FC7;this.param1&#x7684;&#x65B9;&#x5F0F;&#x4F7F;&#x7528;&#xFF0C;param1&#x4E3A;json&#x4E2D;&#x7684;&#x53C2;&#x6570;&#x540D;&#xFF0C;param1&#x5BF9;&#x5E94;&#x7684;&#x503C;&#x4F1A;&#x7EDF;&#x4E00;&#x8F6C;&#x6362;&#x4E3A;String&#x7C7B;&#x578B;&#x3002;</td>
</tr>
</tbody>
</table>
<p>&#x8981;&#x8DF3;&#x8F6C;&#x5230;&#x7684;uri&#xFF0C;&#x53EF;&#x4EE5;&#x662F;&#x4E0B;&#x9762;&#x7684;&#x683C;&#x5F0F;&#xFF1A;</p>
<ol>
<li>&#x4EE5;&quot;/&quot;&#x5F00;&#x5934;&#x7684;&#x5E94;&#x7528;&#x5185;&#x9875;&#x9762;&#x7684;&#x8DEF;&#x5F84;&#xFF1B;&#x4F8B;&#xFF1A;/about</li>
<li>&#x4EE5;&#x975E;&quot;/&quot;&#x5F00;&#x5934;&#x7684;&#x5E94;&#x7528;&#x5185;&#x9875;&#x9762;&#x7684;&#x540D;&#x79F0;&#xFF1B;&#x4F8B;&#xFF1A;About</li>
<li>&#x7279;&#x6B8A;&#x7684;&#xFF0C;&#x5982;&#x679C;uri&#x7684;&#x503C;&#x662F;&quot;/&quot;&#xFF0C;&#x5219;&#x8DF3;&#x8F6C;&#x5230;path&#x4E3A;&quot;/&quot;&#x7684;&#x9875;&#xFF0C;&#x6CA1;&#x6709;&#x5219;&#x8DF3;&#x8F6C;&#x5230;&#x9996;&#x9875;&#x3002;</li>
</ol>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.router.replace({
  uri: <span class="hljs-string">&apos;/test&apos;</span>,
  params: {
    testId: <span class="hljs-string">&apos;1&apos;</span>
  }
})
</code></pre>
<h4 id="unirouterback">uni.router.back()</h4>
<p>&#x8FD4;&#x56DE;&#x4E0A;&#x4E00;&#x9875;&#x9762;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<p>&#x65E0;&#x3002;</p>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// A&#x9875;&#x9762;  </span>
uni.router.push({
  uri: <span class="hljs-string">&apos;B&apos;</span>
})

<span class="hljs-comment">// B&#x9875;&#x9762;  </span>
uni.router.push({
  uri: <span class="hljs-string">&apos;C&apos;</span>
})

<span class="hljs-comment">// C&#x9875;&#x9762;&#x901A;&#x8FC7;back&#xFF0C;&#x5C06;&#x8FD4;&#x56DE;B&#x9875;&#x9762;  </span>
uni.router.back();
<span class="hljs-comment">// B&#x9875;&#x9762;&#x901A;&#x8FC7;back&#xFF0C;&#x5C06;&#x8FD4;&#x56DE;A&#x9875;&#x9762;  </span>
uni.router.back();
</code></pre>
<h4 id="unirouterclear">uni.router.clear()</h4>
<p>&#x6E05;&#x7A7A;&#x6240;&#x6709;&#x5386;&#x53F2;&#x9875;&#x9762;&#x8BB0;&#x5F55;&#xFF0C;&#x4EC5;&#x4FDD;&#x7559;&#x5F53;&#x524D;&#x9875;&#x9762;&#xFF0C;&#x5373;&#x4FDD;&#x7559;&#x6808;&#x9876;&#x9875;&#x9762;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<p>&#x65E0;&#x3002;</p>
<p>&#x793A;&#x4F8B;</p>
<pre><code>uni.router.clear();
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="general.html" class="navigation navigation-prev " aria-label="Previous page: 通用规则">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="interface.html" class="navigation navigation-next " aria-label="Next page: 界面交互">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"基本功能","level":"1.5.2","depth":2,"next":{"title":"界面交互","level":"1.5.3","depth":2,"path":"api/interface.md","ref":"api/interface.md","articles":[]},"previous":{"title":"通用规则","level":"1.5.1","depth":2,"path":"api/general.md","ref":"api/general.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"api/basic.md","mtime":"2018-02-13T03:29:39.723Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-04-04T08:24:24.953Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

